package com.yuan.config;

import com.yuan.pojo.Dog;
import com.yuan.myconditional.MyConditional;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DogConfig {

    @Bean("dog")
    @Conditional({MyConditional.class})  // 返回真的时候装配，返回假的时候不装配
    public Dog getDog() {
        return new Dog();
    }

}
